<template>
  <el-popconfirm
    title="确定删除这一条记录吗?"
    @confirm="handleClick"
  >
    <el-button
      slot="reference"
      :type="type"
      v-bind="$attrs"
    >{{ text }}</el-button>
  </el-popconfirm>
</template>

<script>
export default {
  name: 'CButton',
  props: {
    autoConfirm: {
      type: Boolean,
      default: false
    },
    text: {
      type: String,
      default: '删除'
    },
    type: {
      type: String,
      default: ''
    },
    confirmConfig: {
      type: Object,
      default: () => ({})
    }
  },
  methods: {
    handleClick() {
      console.log('点击确认')
      console.log('this.autoConfirm=', this.autoConfirm)
      if (this.autoConfirm) {
        this.$emit('confirm')
      }/* else {
        this.$emit('click')
      }*/
    }
  }
}
</script>

<style scoped>

</style>
